/* Copyright (c) [Year] [name of copyright holder]
 * [Software Name] is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *      http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package com.gitee.empty_null.core.exception;

import com.gitee.empty_null.core.pojo.StatusCode;
import lombok.Getter;

/**
 * @author xuhainan
 * @date 2023/8/23 15:42
 * @region hefei
 */
@Getter
@SuppressWarnings("serial")
public class UnionCommonException extends RuntimeException {

    private final String message;

    @Getter
    private int code = StatusCode.FAIL.getCode();

    public UnionCommonException(String message) {
        super(message);
        this.message = message;
    }

    public UnionCommonException(int code, String message) {
        super(message);
        this.message = message;
        this.code = code;
    }

    public UnionCommonException(StatusCode statusCode) {
        super(statusCode.getMsg());
        this.message = statusCode.getMsg();
        this.code = statusCode.getCode();
    }

    public UnionCommonException(int code, String message, Throwable cause) {
        super(cause);
        this.message = message;
        this.code = code;
    }

    public UnionCommonException(StatusCode statusCode, Throwable cause) {
        super(statusCode.getMsg(), cause);
        this.message = statusCode.getMsg();
        this.code = statusCode.getCode();
    }


}
